<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8">
    
    <title>SFC64 Small Fast Chaotic PRNG &mdash; NumPy v1.18 Manual</title>
    
    <link rel="stylesheet" type="text/css" href="../../../_static/css/spc-bootstrap.css">
    <link rel="stylesheet" type="text/css" href="../../../_static/css/spc-extend.css">
    <link rel="stylesheet" href="../../../_static/scipy.css" type="text/css" >
    <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" >
    <link rel="stylesheet" href="../../../_static/graphviz.css" type="text/css" >
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../../',
        VERSION:     '1.18.1',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  false
      };
    </script>
    <script type="text/javascript" src="../../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../../_static/doctools.js"></script>
    <script type="text/javascript" src="../../../_static/language_data.js"></script>
    <script type="text/javascript" src="../../../_static/js/copybutton.js"></script>
    <link rel="author" title="About these documents" href="../../../about.html" >
    <link rel="index" title="Index" href="../../../genindex.html" >
    <link rel="search" title="Search" href="../../../search.html" >
    <link rel="top" title="NumPy v1.18 Manual" href="../../../index.html" >
    <link rel="up" title="Bit Generators" href="index.html" >
    <link rel="next" title="numpy.random.SFC64.state" href="generated/numpy.random.SFC64.state.html" >
    <link rel="prev" title="numpy.random.Philox.ctypes" href="generated/numpy.random.Philox.ctypes.html" > 
  </head>
  <body>
<div class="container">
  <div class="top-scipy-org-logo-header" style="background-color: #a2bae8;">
    <a href="../../../index.html">
      <img border=0 alt="NumPy" src="../../../_static/numpy_logo.png"></a>
    </div>
  </div>
</div>


    <div class="container">
      <div class="main">
        
	<div class="row-fluid">
	  <div class="span12">
	    <div class="spc-navbar">
              
    <ul class="nav nav-pills pull-left">
        <li class="active"><a href="https://numpy.org/">NumPy.org</a></li>
        <li class="active"><a href="https://numpy.org/doc">Docs</a></li>
        
        <li class="active"><a href="../../../index.html">NumPy v1.18 Manual</a></li>
        

          <li class="active"><a href="../../index.html" >NumPy Reference</a></li>
          <li class="active"><a href="../../routines.html" >Routines</a></li>
          <li class="active"><a href="../index.html" >Random sampling (<code class="xref py py-mod docutils literal notranslate"><span class="pre">numpy.random</span></code>)</a></li>
          <li class="active"><a href="index.html" accesskey="U">Bit Generators</a></li> 
    </ul>
              
              
    <ul class="nav nav-pills pull-right">
      <li class="active">
        <a href="../../../genindex.html" title="General Index"
           accesskey="I">index</a>
      </li>
      <li class="active">
        <a href="generated/numpy.random.SFC64.state.html" title="numpy.random.SFC64.state"
           accesskey="N">next</a>
      </li>
      <li class="active">
        <a href="generated/numpy.random.Philox.ctypes.html" title="numpy.random.Philox.ctypes"
           accesskey="P">previous</a>
      </li>
    </ul>
              
	    </div>
	  </div>
	</div>
        

	<div class="row-fluid">
      <div class="spc-rightsidebar span3">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../../../contents.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">SFC64 Small Fast Chaotic PRNG</a><ul>
<li><a class="reference internal" href="#state">State</a></li>
<li><a class="reference internal" href="#extending">Extending</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="generated/numpy.random.Philox.ctypes.html"
                        title="previous chapter">numpy.random.Philox.ctypes</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="generated/numpy.random.SFC64.state.html"
                        title="next chapter">numpy.random.SFC64.state</a></p>
<div id="searchbox" style="display: none" role="search">
  <h4>Quick search</h4>
    <div>
    <form class="search" action="../../../search.html" method="get">
      <input type="text" style="width: inherit;" name="q" />
      <input type="submit" value="search" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
          <div class="span9">
            
        <div class="bodywrapper">
          <div class="body" id="spc-section-body">
            
  <div class="section" id="sfc64-small-fast-chaotic-prng">
<h1>SFC64 Small Fast Chaotic PRNG<a class="headerlink" href="#sfc64-small-fast-chaotic-prng" title="Permalink to this headline">¶</a></h1>
<dl class="class">
<dt id="numpy.random.SFC64">
<em class="property">class </em><code class="sig-prename descclassname">numpy.random.</code><code class="sig-name descname">SFC64</code><span class="sig-paren">(</span><em class="sig-param">seed=None</em><span class="sig-paren">)</span><a class="headerlink" href="#numpy.random.SFC64" title="Permalink to this definition">¶</a></dt>
<dd><p>BitGenerator for Chris Doty-Humphrey’s Small Fast Chaotic PRNG.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>seed</strong><span class="classifier">{None, int, array_like[ints], SeedSequence}, optional</span></dt><dd><p>A seed to initialize the <a class="reference internal" href="generated/numpy.random.BitGenerator.html#numpy.random.BitGenerator" title="numpy.random.BitGenerator"><code class="xref py py-obj docutils literal notranslate"><span class="pre">BitGenerator</span></code></a>. If None, then fresh,
unpredictable entropy will be pulled from the OS. If an <code class="docutils literal notranslate"><span class="pre">int</span></code> or
<code class="docutils literal notranslate"><span class="pre">array_like[ints]</span></code> is passed, then it will be passed to
<a class="reference internal" href="generated/numpy.random.SeedSequence.html#numpy.random.SeedSequence" title="numpy.random.SeedSequence"><code class="xref py py-obj docutils literal notranslate"><span class="pre">SeedSequence</span></code></a> to derive the initial <a class="reference internal" href="generated/numpy.random.BitGenerator.html#numpy.random.BitGenerator" title="numpy.random.BitGenerator"><code class="xref py py-obj docutils literal notranslate"><span class="pre">BitGenerator</span></code></a> state. One may also
pass in a <a class="reference internal" href="generated/numpy.random.SeedSequence.html#numpy.random.SeedSequence" title="numpy.random.SeedSequence"><code class="xref py py-obj docutils literal notranslate"><span class="pre">SeedSequence</span></code></a> instance.</p>
</dd>
</dl>
</dd>
</dl>
<p class="rubric">Notes</p>
<p><code class="docutils literal notranslate"><span class="pre">SFC64</span></code> is a 256-bit implementation of Chris Doty-Humphrey’s Small Fast
Chaotic PRNG (<a class="reference internal" href="#r50352647a6aa-1" id="id1">[1]</a>). <code class="docutils literal notranslate"><span class="pre">SFC64</span></code> has a few different cycles that one might be
on, depending on the seed; the expected period will be about
<img class="math" src="../../../_images/math/ecad3f1295fb49e3c84334c4573bdda2ca81c0b7.svg" alt="2^{255}"/> (<a class="reference internal" href="#r50352647a6aa-2" id="id2">[2]</a>). <code class="docutils literal notranslate"><span class="pre">SFC64</span></code> incorporates a 64-bit counter which means
that the absolute minimum cycle length is <img class="math" src="../../../_images/math/47e87a1638fac5fa3416ef91f07e6f3572eed8a6.svg" alt="2^{64}"/> and that distinct
seeds will not run into each other for at least <img class="math" src="../../../_images/math/47e87a1638fac5fa3416ef91f07e6f3572eed8a6.svg" alt="2^{64}"/> iterations.</p>
<p><code class="docutils literal notranslate"><span class="pre">SFC64</span></code> provides a capsule containing function pointers that produce
doubles, and unsigned 32 and 64- bit integers. These are not
directly consumable in Python and must be consumed by a <code class="docutils literal notranslate"><span class="pre">Generator</span></code>
or similar object that supports low-level access.</p>
<p><strong>State and Seeding</strong></p>
<p>The <code class="docutils literal notranslate"><span class="pre">SFC64</span></code> state vector consists of 4 unsigned 64-bit values. The last
is a 64-bit counter that increments by 1 each iteration.</p>
<p>The input seed is processed by <a class="reference internal" href="generated/numpy.random.SeedSequence.html#numpy.random.SeedSequence" title="numpy.random.SeedSequence"><code class="xref py py-obj docutils literal notranslate"><span class="pre">SeedSequence</span></code></a> to generate the first
3 values, then the <code class="docutils literal notranslate"><span class="pre">SFC64</span></code> algorithm is iterated a small number of times
to mix.</p>
<p><strong>Compatibility Guarantee</strong></p>
<p><code class="docutils literal notranslate"><span class="pre">SFC64</span></code> makes a guarantee that a fixed seed will always produce the same
random integer stream.</p>
<p class="rubric">References</p>
<dl class="citation">
<dt class="label" id="r50352647a6aa-1"><span class="brackets"><a class="fn-backref" href="#id1">1</a></span></dt>
<dd><p><a class="reference external" href="http://pracrand.sourceforge.net/RNG_engines.txt">“PractRand”</a></p>
</dd>
<dt class="label" id="r50352647a6aa-2"><span class="brackets"><a class="fn-backref" href="#id2">2</a></span></dt>
<dd><p><a class="reference external" href="http://www.pcg-random.org/posts/random-invertible-mapping-statistics.html">“Random Invertible Mapping Statistics”</a></p>
</dd>
</dl>
</dd></dl>

<div class="section" id="state">
<h2>State<a class="headerlink" href="#state" title="Permalink to this headline">¶</a></h2>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.random.SFC64.state.html#numpy.random.SFC64.state" title="numpy.random.SFC64.state"><code class="xref py py-obj docutils literal notranslate"><span class="pre">state</span></code></a></p></td>
<td><p>Get or set the PRNG state</p></td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="extending">
<h2>Extending<a class="headerlink" href="#extending" title="Permalink to this headline">¶</a></h2>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.random.SFC64.cffi.html#numpy.random.SFC64.cffi" title="numpy.random.SFC64.cffi"><code class="xref py py-obj docutils literal notranslate"><span class="pre">cffi</span></code></a></p></td>
<td><p>CFFI interface</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.random.SFC64.ctypes.html#numpy.random.SFC64.ctypes" title="numpy.random.SFC64.ctypes"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ctypes</span></code></a></p></td>
<td><p>ctypes interface</p></td>
</tr>
</tbody>
</table>
</div>
</div>


          </div>
        </div>
          </div>
        </div>
      </div>
    </div>

    <div class="container container-navbar-bottom">
      <div class="spc-navbar">
        
      </div>
    </div>
    <div class="container">
    <div class="footer">
    <div class="row-fluid">
    <ul class="inline pull-left">
      <li>
        &copy; Copyright 2008-2019, The SciPy community.
      </li>
      <li>
      Last updated on Feb 20, 2020.
      </li>
      <li>
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 2.4.2.
      </li>
    </ul>
    </div>
    </div>
    </div>
  </body>
</html>